package com.freeter.modules.cityrecord.entity;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.util.Date;


/**
 * 城市记录
 * 数据库通用操作实体类（普通增删改查）
 *
 * @author xuchen
 * @email 171998110@qq.com
 * @date 2019-04-07 14:01:49
 */
@TableName("city_record")
@ApiModel(value = "CityRecord")
public class CityRecordEntity<T> implements Serializable {
    private static final long serialVersionUID = 1L;


    public CityRecordEntity() {

    }

    public CityRecordEntity(T t) {
        try {
            BeanUtils.copyProperties(this, t);
        } catch (IllegalAccessException | InvocationTargetException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    /**
     *
     */

    @TableId
    @ApiModelProperty(value = "", hidden = true)
    private Integer id;

    /**
     * 用户id
     */

    @NotBlank(message = "用户id不能为空")
    @ApiModelProperty(value = "用户id")
    private String userId;

    /**
     * 省id
     */

    @NotBlank(message = "省id不能为空")
    @ApiModelProperty(value = "省id")
    private String provinceId;

    /**
     * 市id
     */

    @NotBlank(message = "市id不能为空")
    @ApiModelProperty(value = "市id")
    private String cityId;

    /**
     * 图片url
     */

    @NotBlank(message = "图片url不能为空")
    @ApiModelProperty(value = "图片url")
    private String imgUrl;

    /**
     * 标题
     */

    @NotBlank(message = "标题不能为空")
    @ApiModelProperty(value = "标题")
    private String title;

    /**
     * 内容
     */

    @NotBlank(message = "内容不能为空")
    @ApiModelProperty(value = "内容")
    private String content;

    /**
     * 创建时间
     */

    @NotNull(message = "创建时间不能为空")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private Date cTime;

    /**
     * 更新时间
     */

    @NotNull(message = "更新时间不能为空")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新时间")
    private Date uTime;

    /**
     * 是否有效
     */

    @NotNull(message = "是否有效不能为空")
    @ApiModelProperty(value = "是否有效")
    private Integer flag;
    @TableField(exist = false)
    private String provinceName;
    @TableField(exist = false)
    private String cityName;

    /**
     * 设置：
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * 获取：
     */
    public Integer getId() {
        return id;
    }

    /**
     * 设置：用户id
     */
    public void setUserId(String userId) {
        this.userId = userId;
    }

    /**
     * 获取：用户id
     */
    public String getUserId() {
        return userId;
    }

    /**
     * 设置：省id
     */
    public void setProvinceId(String provinceId) {
        this.provinceId = provinceId;
    }

    /**
     * 获取：省id
     */
    public String getProvinceId() {
        return provinceId;
    }

    /**
     * 设置：市id
     */
    public void setCityId(String cityId) {
        this.cityId = cityId;
    }

    /**
     * 获取：市id
     */
    public String getCityId() {
        return cityId;
    }

    /**
     * 设置：图片url
     */
    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }

    /**
     * 获取：图片url
     */
    public String getImgUrl() {
        return imgUrl;
    }

    /**
     * 设置：标题
     */
    public void setTitle(String title) {
        this.title = title;
    }

    /**
     * 获取：标题
     */
    public String getTitle() {
        return title;
    }

    /**
     * 设置：内容
     */
    public void setContent(String content) {
        this.content = content;
    }

    /**
     * 获取：内容
     */
    public String getContent() {
        return content;
    }

    /**
     * 设置：创建时间
     */
    public void setCTime(Date cTime) {
        this.cTime = cTime;
    }

    /**
     * 获取：创建时间
     */
    public Date getCTime() {
        return cTime;
    }

    /**
     * 设置：更新时间
     */
    public void setUTime(Date uTime) {
        this.uTime = uTime;
    }

    /**
     * 获取：更新时间
     */
    public Date getUTime() {
        return uTime;
    }

    /**
     * 设置：是否有效
     */
    public void setFlag(Integer flag) {
        this.flag = flag;
    }

    /**
     * 获取：是否有效
     */
    public Integer getFlag() {
        return flag;
    }

    public String getProvinceName() {
        return provinceName;
    }

    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }

    public String getCityName() {
        return cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
}
